package org.third.common.jdk8;

import java.util.Optional;

public final class LamdaTest {
	// private SuiteFeature getFeature(String suiteInfoPath, String
	// suiteFeaturePath,
	// String featureVersion) throws Exception {
	//
	// return getFeatureRelatedFile(suiteInfoPath)
	// .flatMap(LambdaExceptionUtil.rethrowFunction(str -> {
	// SuiteInfoBean suiteInfoBean = objectMapper.readValue(str,
	// SuiteInfoBean.class);
	// if (suiteInfoBean.getSuiteInfoList().get(0).getVersions() != null) {
	// Optional<Version> versions =
	// suiteInfoBean.getSuiteInfoList().get(0).getVersions()
	// .stream()
	// .filter(baseVersion -> featureVersion.equals(baseVersion.getVersion()))
	// .findFirst();
	// System.out.println(versions);
	// return versions;
	//
	// }
	// return Optional.empty();
	// }))
	// .flatMap(LambdaExceptionUtil.rethrowFunction(version -> {
	// String featureFile = version.getFeatures();
	// if (!StringUtils.isEmpty(featureFile)) {
	// Optional<SuiteFeature> optional = getFeatureRelatedFile(
	// new PathBuilder(suiteFeaturePath).addPath(featureFile).buildUnixPath())
	// .map(LambdaExceptionUtil.rethrowFunction(
	// featureStr -> objectMapper.readValue(featureStr, SuiteFeature.class)));
	// return optional;
	// }
	// return Optional.empty();
	// })).orElse(null);
	//// return null;
	//
	// }
	public static void main(String[] args) {
		// 调用工厂方法创建Optional实例
		java.util.Optional<String> name = Optional.of("Sanaulla");
		// 传入参数为null，抛出NullPointerException.
		java.util.Optional<String> someNull = Optional.of(null);
	}
}
